package cn.gwm.flink.streaming.beans.estimateSoh;

import lombok.Data;

import java.io.Serializable;
import java.lang.reflect.Field;
import java.math.BigDecimal;
import java.util.Objects;

/**
 * soh估算dws层数据
 * @author GW00283474
 */
@Data
public class EstimateSohEvDws implements Serializable {
    BigDecimal BMS_SOC;
    Integer VCU_VCUSts;
    String model_code;
    BigDecimal longitude;
    BigDecimal latitude;
    BigDecimal BMS_SOH;
    String deviceId;
    String model_name;
    String vehicletype;
    BigDecimal BMS_RMC_CellVoltMin;
    BigDecimal dvMin;
    BigDecimal BMS_RMC_CellVoltMax;
    BigDecimal dvMax;
    BigDecimal BMS_TotlChrgAh_RM;
    BigDecimal BMS_TotlDchrgAh_RM;
    BigDecimal cumulativeChrgAhRm;
    BigDecimal cumulativeDchrgAhRm;
    BigDecimal totlAh;
    BigDecimal dQ;
    BigDecimal ratio1;
    BigDecimal ratio2;
    BigDecimal BMS_BattCurr_RM;
    Long item_time;
    String license_plate;
    String cell_battery_type;
    Integer BMS_ModuleTempaverage;
    BigDecimal pack_capacity;
    BigDecimal BMS_InnerSOCmax;
    BigDecimal differenceSocMax;
    BigDecimal BMS_InnerSOCmin;
    BigDecimal differenceSocMin;
    Boolean platformValidFlag;
    Boolean platformValidFlagMax;
    Boolean platformValidFlagMin;
    Boolean triggerFlag;
    Boolean enableFlag;
    Boolean sleepStillFlag;
    Boolean onlineStillFlag;
    Boolean capacityAbandonFlag;
    Boolean netModelAbandonFlag;
    String processDate;
    String modelEstimateSoh;
    String modelEstimateTime;
    String modelEstimateDate;

    /**
     *
     * @param split 分隔符
     * @return
     */
    public String getPropertyInfo(String split){
        String record="";
        Field[] fields = this.getClass().getDeclaredFields();
        try {
            for (int i = 0; i < fields.length; i++) {
                String name = fields[i].getName();
                    Object obj = fields[i].get(this);
                    if(Objects.nonNull(obj)){
                        record+=obj.toString()+split;
                    }else{
                        record+=""+split;
                    }
            }
        }catch (Exception e){
            e.printStackTrace();
        }

        if(record.contains(split)){
            record=record.substring(0,record.lastIndexOf(split));
        }
        return record;
    }
}
